<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>修改角色——后台管理</title>
    <link rel="stylesheet" type="text/css" href="<?php echo ADMIN_PUC;?>/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="<?php echo ADMIN_PUC;?>/css/main.css"/>
    <script type="text/javascript" src="<?php echo ADMIN_PUC;?>/js/libs/modernizr.min.js"></script>
    <script type="text/javascript" src="<?php echo ADMIN_PUC;?>/js/jquery-1.4.2.min.js"></script>
</head>
<body>
<include file="Common/top" /> 
<div class="container clearfix">
    <div class="sidebar-wrap">
        <div class="sidebar-title">
            <h1>菜单</h1>
        </div>
        <include file="Common/left" /> 
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="__MODULE__/Role/lst">角色管理</a><span class="crumb-step">&gt;</span><span>修改角色</span></div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="" method="post" id="myform" name="myform" enctype="multipart/form-data">
                    <input type="hidden" name="id" value="{$roleres.id}" />
                    <table class="insert-tab" width="100%">
                        <tbody>
                            <tr>
                                <th><i class="require-red">*</i>角色名称：</th>
                                <td>
                                    <input class="common-text required" id="title" name="rolename" size="50" value="{$roleres.rolename}" type="text">
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>角色的权限：</th>
                                <td>
                                <ul>
                                <?php foreach($pris as $k=>$v):
                                         //,3,2,4,53,               //,3,
                                if(strpos(','.$roleres['pri_id_list'].',',','.$v['id'].',')!==false){
                                    $check="checked='checked'";
                                }else{
                                    $check='';
                                }
                                ?>
                                <li level="<?php echo $v['level'];?>">
                                <input <?php echo $check;?> class="common-text" name="pri_id_list[]" size="50" value="<?php echo $v['id'];?>" type="checkbox">
                                <if condition="$vo['parentid'] neq 0">|</if>
                                <?php $v['parentid'] ? '|':'';?>
                                <?php echo str_repeat('-', $v['level']*8);?>
                                <?php echo $v['pri_name'];?>
                                </li>
                                <?php endforeach;?>
                                </ul>
                                </td>
                            </tr>
                            
                            <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>
                </form>
            </div>
        </div>

    </div>
    <!--/main-->
</div>
</body>
</html>
<script type="text/javascript">
    $(":checkbox").click(function(){
        var cur_li=$(this).parent();
        var level=cur_li.attr("level");
        var checked=$(this).attr("checked");
        cur_li.prevAll("li").each(function(){
            if($(this).attr("level")<level && checked ){
                $(this).find(":checkbox").attr("checked","checked");
                if($(this).attr("level")==0){
                    return false;
                }
            }
        });

        if(!checked){
           //
           cur_li.nextAll("li").each(function(){
            if($(this).attr("level")>level){
                $(this).find(":checkbox").removeAttr("checked");
                
            }else{
                return false;
            }
        });
           //
        }

    });
</script>